package com.hyh.music.controller.userController;

import com.hyh.music.Result.Result;
import com.hyh.music.domain.domainDTO.ConsumerLoginDTO;
import com.hyh.music.domain.domains.Consumer;
import com.hyh.music.service.ConsumerService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hyh
 * @version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/user/consumer")
@RequiredArgsConstructor
public class UserConsumerController {

    private final ConsumerService consumerService;

    @PostMapping("/login")
    public Result<Consumer> login(@RequestBody ConsumerLoginDTO consumerLoginDTO){
        log.info("用户登录，登录信息为{}",consumerLoginDTO);
        Consumer consumer = consumerService.login(consumerLoginDTO);
        return Result.success(consumer);
    }

}
